package com.example.demo.controller;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;


import javax.xml.namespace.QName;
import java.net.URL;

public class test {
    public static void main(String[] args) {
        try {
            JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
            Client client = factory.createClient("http://localhost:8080/mlbsv2/webService/bqkPush?wsdl");
            Object[] res = null;
            String s = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                    +" <StandardPushXmlBean>"
                    +"    <data>"
                    +"      <columns>"
                    +"        <column> "
                    +"          <columnCnName>手机号码</columnCnName>"
                    +"          <columnDataType>VARCHAR</columnDataType>"
                    +"          <columnLength>32</columnLength>"
                    +"          <columnName>PRODUCT_NO</columnName>"
                    +"          <isPrimaryKey>1</isPrimaryKey>"
                    +"        </column>"
                    +"        <column>"
                    +"</column>"
                    +"      </columns>"
                    +"      <crtPersnName>郑哲鹏</crtPersnName>     "
                    +"      <crtTime>2016-10-08 13:37:45</crtTime>"
                    +"      <customGroupDesc/>"
                    +"      <customGroupId>KHQ57000016866</customGroupId>  --客户群编号"
                    +"      <customGroupName>跨网一人多号郑航嵩</customGroupName> --客户群名称"
                    +"      <customRules/>"
                    +"      <dataCycle>3</dataCycle> --更新周期，1 一次性 ，2 月周期 ，3 日周期"
                    +"      <dataCycleDesc>日周期</dataCycleDesc>"
                    +"      <dataDate>20161007</dataDate> --数据日期"
                    +"      <effective_time>2016-09-13 00:00:00</effective_time> --生效日期"
                    +"      <fail_time>2016-12-31 00:00:00</fail_time> --失效日期"
                    +"      <platformCode>COC</platformCode>"
                    +"      <pushToUserIds/>"
                    +"      <reqId>COC201610081351362451</reqId>"
                    +"      <rowNumber>244808</rowNumber> --记录数"
                    +"      <uploadFileDesc>清单文件</uploadFileDesc>"
                    +"      <uploadFileName>COC_zhengzhepeng_20161008135131111.csv</uploadFileName>--文件名"
                    +"      <uploadFileType>csv</uploadFileType>"
                    +"      <userId>zhengzhepeng</userId> --创建人ID"
                    +"    </data>"
                    +"    <title>"
                    +"      <sendTime>2016-10-08 13:51:39</sendTime>"
                    +"      <taskDesc>9.地市集中库推送任务</taskDesc>"
                    +"    </title>"
                    +"  </StandardPushXmlBean>";
            try {
                res = client.invoke("noticeFile", s);//后面为WebService请求参数数组
                System.out.println(res[0]);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
